#!/usr/bin/env ruby

# We need to make our own RAILS_ROOT here because
# this file is started outside of rails.
unless defined?(RAILS_ROOT)
  root_path = File.join(File.dirname(__FILE__), '../..')
  unless RUBY_PLATFORM =~ /mswin32/
    require 'pathname'
    root_path = Pathname.new(root_path).cleanpath(true).to_s
  end
  RAILS_ROOT = root_path
end

pid = File.open("#{RAILS_ROOT}/log/backgroundrb.pid"){|f| f.read.chomp.to_i }

Process.kill(9, pid)
